package com.promotores;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;



public class AdapterTipoPromocion extends BaseAdapter{
	List<BeanTipoPromocion> lista;
	Context context;
	LayoutInflater inflater;
	
	public AdapterTipoPromocion(List<BeanTipoPromocion> lista, Context context){
		this.lista = lista;
		this.context = context;
		inflater = LayoutInflater.from(context);
	}
	@Override
	public int getCount() {
		return lista.size();
	}

	@Override
	public Object getItem(int position) {
		return lista.get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		
		if (convertView == null){
			convertView = inflater.inflate(R.layout.pr_item_tipo_promocion, null);
			
			holder = new ViewHolder();
			holder.lbltipopromocion = (TextView) convertView.findViewById(R.id.lbltipopromocion);
			
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder)convertView.getTag();
		}
		
		BeanTipoPromocion tipoPromocion = lista.get(position);
		holder.lbltipopromocion.setText(tipoPromocion.getTipoPromocion());

		
		return convertView;
	}
	
	class ViewHolder{
		TextView lbltipopromocion;
		
	}
}
